home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / pc / files / t_unix / j109lxa4.tar / sessmgr.h < prev    next >
C/C++ Source or Header  |  1994-06-04  |  5KB  |  96 lines

  1. /*
  2.  * Session manager interface
  3.  *
  4.  * NOS uses several functions to interface with the outside world (not
  5.  * including printf, which I'm trying to stomp out).  These were originally
  6.  * called directly.
  7.  *
  8.  * The JNOS session manager translates calls to these functions into calls
  9.  * through a "session manager switch".  This switch is an array of pointers to
  10.  * session manager definitions, including a session manager name and a series
  11.  * of function pointers.  Each session has a pointer to its session manager
  12.  * definition taken from the session manager switch, and a pointer to data
  13.  * which is specific to (and only known to) the session manager.
  14.  *
  15.  * There are several internal session managers:
  16.  *
  17.  * none
  18.  *    All session manager operations are mapped to null functions except
  19.  *    the keyboard, which maps to a function that never returns.  Used from
  20.  *    /etc/rc.  Remappable.
  21.  *    (Not yet present.  Without external sessions, this one is fatal...)
  22.  *
  23.  * dumb
  24.  *    No screen or keyboard operations; suitable for use as a pipe (!) or
  25.  *    file output.  Remappable.  (This one may not stay; it's intended more
  26.  *    for debugging and experimentation with the session manager than for
  27.  *    any practical use.)
  28.  *
  29.  * raw
  30.  *    Uses raw terminfo for built-in operations, passes everything else to
  31.  *    the actual terminal.  Another testing one.
  32.  *    (Present but not tested:  ncurses has bugs in its terminfo-only
  33.  *    interface.  May test this under SCO.)
  34.  * 
  35.  * curses
  36.  *    The "original" session interface.
  37.  *
  38.  * ansi
  39.  *    A modified "curses" with ANSI-X3.64 and PC line graphics support.
  40.  *    (This will become a per-session option to "curses".)
  41.  *
  42.  * I intend to provide an "xterm" interface, which spawns slave xterms for its
  43.  * sessions.
  44.  *
  45.  * The "wherex" and "wherey" entries are a problem for externally located
  46.  * sessions, not to mention the "none" and "dumb" session managers.  They are
  47.  * only used with split sessions.
  48.  *
  49.  * This is *not* the external session manager, which is a different entity
  50.  * entirely.  The external session manager is a JNOS task which waits for
  51.  * connections on a (Unix-domain or possibly IP) system socket and spawns
  52.  * sessions whose I/O is mapped to the outside connection.  To map the I/O,
  53.  * the external session manager will use a private session manager definition
  54.  * (not present in the session manager switch), so this is a prerequisite for
  55.  * external sessions... but this does not in and of itself enable external
  56.  * sessions.  (External sessions also have headaches of their own:  the trace
  57.  * and command sessions.  More later, when I tackle external sessions.)
  58.  */
  59.  
  60. struct sessmgr_sw
  61. {
  62.     char *name;
  63.     int flags;
  64. #define SM_SPLIT    0x01    /* can handle split sessions */
  65. #define SM_STDIO    0x02    /* multiplexed on stdin/stdout */
  66. #define SM_SUSPEND    0x04    /* internal: suspended mpx'ed session */
  67. #define SM_INIT        0x08    /* has been initialized */
  68. #define SM_FIXED    0x10    /* can't change session managers */
  69. #define SM_LOCK        0x20    /* I/O locked to avoid reentrancy problems */
  70.     int (*init) __ARGS((const struct sessmgr_sw *));
  71.     char *(*options) __ARGS((const struct sessmgr_sw *, char *));
  72.     void *(*create) __ARGS((const struct sessmgr_sw *, struct session *));
  73.     char *(*sessopt) __ARGS((const struct sessmgr_sw *, void *, char *));
  74.     int (*swtch) __ARGS((const struct sessmgr_sw *, void *, void *));
  75.     void (*putch) __ARGS((const struct sessmgr_sw *, void *, int));
  76.     void (*clreol) __ARGS((const struct sessmgr_sw *, void *));
  77.     void (*clrscr) __ARGS((const struct sessmgr_sw *, void *));
  78.     int (*wherex) __ARGS((const struct sessmgr_sw *, void *));
  79.     int (*wherey) __ARGS((const struct sessmgr_sw *, void *));
  80.     void (*window) __ARGS((const struct sessmgr_sw *, void *, int, int, int,
  81.                int));
  82.     void (*gotoxy) __ARGS((const struct sessmgr_sw *, void *, int, int));
  83.     void (*high) __ARGS((const struct sessmgr_sw *, void *));
  84.     void (*norm) __ARGS((const struct sessmgr_sw *, void *));
  85.     void (*cursor) __ARGS((const struct sessmgr_sw *, void *, int));
  86.     int (*kbread) __ARGS((const struct sessmgr_sw *, void *));
  87.     void (*destroy) __ARGS((const struct sessmgr_sw *, void *));
  88.     void (*status) __ARGS((const struct sessmgr_sw *, void *, int, char *));
  89.     void (*rflush) __ARGS((const struct sessmgr_sw *, void *));
  90.     void (*flush) __ARGS((const struct sessmgr_sw *, void *));
  91.     void (*suspend) __ARGS((const struct sessmgr_sw *));
  92.     void (*resume) __ARGS((const struct sessmgr_sw *));
  93.     void (*end) __ARGS((const struct sessmgr_sw *));
  94.     int refcnt;
  95. };
  96.